import { ref, onMounted } from "vue";
import { getOrderGoodsDemo } from "@/api/cloud";
import { OrderGoods } from "@/types/index";

export default function useOrderGoodsDemo() {
  const goodsData = ref<OrderGoods[]>([]);

  const doquery = () => {
    getOrderGoodsDemo().then((res) => {
      const { data } = res;
      if (data.code === 200 && data.result) {
        goodsData.value = data.result;
      }
    });
  };

  onMounted(() => {
    doquery();
  });

  return { goodsData };
}
